#ifndef _RoundBuf_H_
#define _RoundBuf_H_

#include "cx_typedef.h"

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_PACKET_NUM	10

#define FILE_ONE_BLOCK_MAX_SIZE 2048 

typedef enum
{
	eNormalData = 0,
	eFileData,
}DataType;

typedef struct 
{
	DataType	eType;
	QBYTE*		pMsg;
	QBYTE*		pFilePath;
	QINT		nFileLen;
	QINT		nFileRead;
	QINT		wSendLen;
	QINT		wLen;
}PackNode;

typedef struct
{
	PackNode	aPackNode[MAX_PACKET_NUM];
	QINT		wReadPos;
	QINT		wWritePos;
	QINT		wUsedNum;
	QINT       nPostDataLen;
}RoundBuf;

QBOOL 	RoundBuf_Init(RoundBuf* me, QINT size);
void	RoundBuf_Free(RoundBuf* me);
void	RoundBuf_Reset(RoundBuf* me);
QBYTE*	RoundBuf_GetDataForSend(RoundBuf* me, QINT* len);
void	RoundBuf_ReadBuf(RoundBuf* me, QINT size);
QBOOL 	RoundBuf_WriteBuf(RoundBuf* me,QBYTE* data, QINT size);
QBOOL	RoundBuf_WriteBuf2(RoundBuf* me,QBYTE* filepath , QINT size);
QBOOL 	RoundBuf_WriteToHead(RoundBuf* me,QBYTE* data,QINT size);
void	RoundBuf_Reset2(RoundBuf* me);

#ifdef __cplusplus
}
#endif //extern "C"

#endif //_RoundBuf_H_
